package com.qf.commons.core.exception;

import com.qf.commons.data.result.ResultCode;
import lombok.Data;

/**
 * @Author: tiger
 * @Data: 2024/10/22 22:49
 * @Description: 业务异常 - 主动抛出 -会被GlobalExceptionHandler全局异常接收到
 **/

@Data
public class ServiceException extends RuntimeException {

    private int code;

    private String msg;

    public ServiceException(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public ServiceException(ResultCode resultCode) {
        this.code = resultCode.getCode();
        this.msg = resultCode.getMsg();
    }
}
